function Parent(name) {
    this.name = name;
    this.colors = ['red', 'blue', 'green'];
}

Parent.prototype.getName = function () {
    console.log(this.name)
}

function Child(name, age) {

    Parent.call(this, name);

    this.age = age;

}

Child.prototype = new Parent(); //要想引用parent的方法，就必须写这个 

var child1 = new Child('kevin', '18');

child1.colors.push('black');

console.log(child1.name); // kevin
console.log(child1.age); // 18
console.log(child1.colors); // ["red", "blue", "green", "black"]

var child2 = new Child('daisy', '20');

console.log(child2.name); // daisy
console.log(child2.age); // 20
console.log(child2.colors); // ["red", "blue", "green"]

var a = 1;
var b = new Number(a);
console.log(typeof b);//object
console.log(b);

var foo = { foundation: "Mozilla", model: "box", week: 45, transport: "car", month: 7 };
console.log(JSON.stringify(foo, ['week', 'month']));
// {"week":45,"month":7}
console.log(JSON.stringify(foo, ['week']));//意思是后面写了什么数组，就把谁转化为字符串
// {"week":45}
console.log([] + []);//""空字符串

console.log(new Date(2017, 04, 21) + 1)
console.log(Number('\n'));//0

const funcs = []
for (let i = 0; i < 3; i++) {
    funcs[i] = function () {
        console.log(i);
    };
    console.log(i, '--i');
}
funcs[0](); // 0
funcs[2](); // 2